# -*- encoding: utf-8 -*-
'''
Filename         :14_longestCommonPrefix.py
Description      :
Time             :2022/08/09 10:10:31
Author           :daiyizheng
Email            :387942239@qq.com
Version          :1.0
'''

from typing import List


class Solution:
    def longestCommonPrefix(self, strs: List[str]) -> str:
        if not strs: return ""
        ss = list(map(set, zip(*strs)))
        res = ""
        for i, x in enumerate(ss):
            x = list(x)
            if len(x) > 1:
                break
            res = res + x[0]
        return res

if __name__ == '__main__':
    a = ["flower","flow","flight"]
    # Solution().longestCommonPrefix(["flower","flow","flight"])
    print(list(map(set, zip(*a))))